function Datastruct = datastruct()
% DATASTRUCT defines the data structure used in spectra object
% It defines the data structure with initial values all are necessary for valid data structure.
%

Datastruct.mainfield = {...
    'data' 'fitting' 'label' 'plotting' 'constants'};

Datastruct.subfield = {...
    ''       ''           ''              ''                ''          ''       ''         ; ...   % Data
    'y_fit'  'function'   'pvals'          'evals'           'chi2'      'R2'     ''         ; ...   % Fitting
    'x'      'y'          'e'              'file'            'dataname'  'pnames' ''         ; ...   % Labels 
    '' '' '' '' '' ''  ''; ...   % Constants
    'meV2K'  'K2meV'      'g'              'meV2T'           'T2meV'     ''       ''         };      % Plotting  

Datastruct.sizefield = {...
    {1, 1}         {}             {}             {}           {}           {}           {}    ;...
    {'nPoints', 1} {1, 'nChar'}   {'nPar', 1}    {'nPar', 1}  {1,1}        {1, 1}       {}    ;...
    {1, 1}   {1, 1}   {1,1}   {1, 1} {1, 1} {1, 1} {}    ;...
    {1, 1}         {1, 1}         {1, 3}         {1, 3}       {1, 2}       {1, 3}       {1, 1};...
    {1, 1}         {1, 1}         {1, 1}         {1, 1}       {1, 1}       {}           {}    };

Datastruct.typefield = {...
    'sp_data' ''  '' ''       ''       ''       ''       ; ...
    'double' 'char'    'double' 'double' 'double' 'double' ''       ; ...
    'char'   'char'    'char'   'char'   'char'   'char'   ''       ; ...
    'sp_plot'   '' '' '' ''   '' ''; ...
    'double' 'double'  'double' 'double' 'double' ''       ''      };

Datastruct.defval = {...
    'sp_data()' ''      '' ''           ''              ''                                                             ''  ; ...
    'zeros(0,1)' '''ngauss_FWHM''' 'zeros(6,1)' 'zeros(6,1)' 'zeros(1,1)'    'zeros(1,1)'                                                   ''  ; ...
    '''X'''      '''Y'''            '''E'''     'pwd'        '''temp.data''' '{''Amp'', ''Center'', ''Width'', ''a*X^2'', ''b*X'', ''c'' }' ''  ; ...
    'sp_plot'      ''                ''   ''    ''             ''                                                      '2' ; ...
    'mev2K(1)'   'K2mev(1)'         '2'         'mev2T(1,2)' 'T2mev(1,2)'    ''                                                             ''};

end